<%-- 
    Document   : TampilSemuaComment
    Created on : Jun 9, 2013, 5:48:01 AM
    Author     : Florencia
--%>

<%@page import="bean.Pembelian"%>
<%@page import="java.util.logging.Logger"%>
<%@page import="java.util.logging.Level"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.Connection"%>
<%@page import="bean.OraConnection"%>
<%@page import="java.sql.ResultSet"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
   <body body background = "gambar/background2.jpg" style = "background-repeat: no-repeat; background-attachment: fixed">
        <%
        out.print("<center>DAFTAR PESAN</center>");
        out.print("<table border='2' align='center'>");
        out.print("<tr><b>");
        out.print("<td>NAMA</td>");
        out.print("<td>EMAIL</td>");
        out.print("<td> PESAN</td>");
        out.print("</b></tr>");



        Connection conn = OraConnection.open("jdbc:oracle:thin:@localhost:1521:xe","hr", "115314023");
        java.sql.Statement statement = null;
        try {
            statement = conn.createStatement();
        } catch (SQLException ex) {
            Logger.getLogger(Pembelian.class.getName()).log(Level.SEVERE, null, ex);
        }
        String sqQ = "select * from PESAN";
        ResultSet result = null;
        try {
            result = statement.executeQuery(sqQ);
        } catch (SQLException ex) {
            Logger.getLogger(Pembelian.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            while (result.next()) {
                Pembelian pem= new Pembelian() ;
                pem.setNama(result.getString("nama"));
                pem.setEmail(result.getString("email"));
                pem.setPesan(result.getString("isipesan"));
                out.println("<tr>");
                out.println("<td><center>" + pem.getNama() + "</center></td>");
                out.println("<td>" + pem.getEmail() + "</td>");
                out.println("<td><center>" +pem.getPesan() + "</center></td>");
                out.println("</tr>");
            }
        } catch (SQLException ex) {
            Logger.getLogger(Pembelian.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            conn.close();
        } catch (SQLException ex) {
        }


out.println("<tr>");

                out.println("<td colspan=2><center>" + "<a href=loginAdmin.jsp style=text-decoration:none><input type=button value=Logout"
                        + "  style=background: orangered; width: 90px ; height: 35px;font-family: Arial Black;font-size: 20px;></a>" + "</center></td>");
                out.println("<td colspan=2><center>" + "<a href=MenuAdmin.jsp style=text-decoration:none><input type=button value=Kembali ke Menu  "
                        + "style=background: orangered; width: 90px ; height: 35px;font-family: Arial Black;font-size: 20px;></a>" + "</td>");
                out.println("</tr>");

        %>

    </body>
</html>
